﻿package dt 
{
	import flash.display.MovieClip;
	/**
	 * ...
	 * @author Doan Nguyen Thuy Nha Truc (Bamboo)
	 */
	public class WinLosePanel extends MovieClip	{
		/*public var bankerWin:MovieClip;
		public var playerWin:MovieClip;
		public var tieWin:MovieClip;
		public var highlightPlayer:MovieClip;
		public var highlightBig:MovieClip;
		public var highlightPlayerPair:MovieClip;
		public var highlightTie:MovieClip;
		public var highlightSmall:MovieClip;
		public var highlightBankerPair:MovieClip;
		public var highlightBanker:MovieClip;*/
		public var dragonWin:MovieClip;
		public var tigerWin:MovieClip;
		public var tieWin:MovieClip;
		public var highlightDragon:MovieClip;
		public var highlightTiger:MovieClip;
		public var highlightTie:MovieClip;
		
		private static const DRAGON_WIN:String = "1";
		private static const TIGER_WIN:String = "2";
		private static const TIE_WIN:String = "3";
		//private static const HIGH_LIGHT:String = "1";
		
		public var highLightArr:Array;
		
		public function WinLosePanel() {
			highLightArr = new Array();
			/*highLightArr = [bankerWin, playerWin, tieWin, highlightPlayer, highlightBig, highlightPlayerPair, highlightTie,
			highlightSmall, highlightBankerPair,highlightBanker];*/
			highLightArr = [this.dragonWin, this.tigerWin, this.tieWin, this.highlightDragon, this.highlightTiger, this.highlightTie];
			init();
			
		}
		/**
		 * @author	Bamboo
		 * @param	result
		 * @usage result 03001; pos 0: success; pos 1: win lose, highlight banker, player, tie ; 
		 * pos 2: highlight bankerpair; pos 3: highlight playerpair;  pos 4: highlight small big
		 */
		public function showWinLose(result:String):void 
		{
			init();
			var type:String = result.substr(1, 1);
			switch(type) {
				case WinLosePanel.DRAGON_WIN:
					show(this.dragonWin);
					show(this.highlightDragon);
					break;
				case WinLosePanel.TIGER_WIN:
					show(this.tigerWin);
					show(this.highlightTiger);
					break;
				case WinLosePanel.TIE_WIN:
					show(this.tieWin);
					show(this.highlightTie);
					break;
			}
			/*
			type = result.substr(2, 1);
			if (type ==WinLosePanel.HIGH_LIGHT)
				show(this.highlightBankerPair);
			type = result.substr(3, 1);
			if(type ==WinLosePanel.HIGH_LIGHT)
				show(this.highlightPlayerPair);
			type = result.substr(4, 1);
			if (type ==WinLosePanel.HIGH_LIGHT)
				show(this.highlightSmall);
			else
				show(this.highlightBig);
				*/
		}
		
		/**
		 * @author	Bamboo
		 * @param	mcWin
		 */
		private function show(mcWin:MovieClip):void {
			mcWin.visible = true;
			mcWin.gotoAndPlay(2);
		}
		/**
		 * @author	Bamboo
		 */
		public function init():void {
			var temp:MovieClip = new MovieClip();
			for (var i:int = 0; i < highLightArr.length; i++)
			{
				temp = highLightArr[i];
				temp.visible = false;
				temp.gotoAndStop(1);
				
			}
		}
	}

}